<%@page import="systems.ConfigSystem"%>
<%@page import="systems.AdsSystem"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="entities.SiteConfig"%>
<%
SiteConfig siteConfig = ConfigSystem.getConfigs();
String title = (String) request.getParameter("title");
String description = (String) request.getParameter("description");
String keywords = (String) request.getParameter("keywords");
String ogSiteName = (String) request.getParameter("ogsite_name");
String ogTitle = (String) request.getParameter("ogtitle"); 
String ogUrl = (String) request.getParameter("ogurl");
String ogImage = (String) request.getParameter("ogimage");
String ogDescription = (String) request.getParameter("ogdescription");

if (title == null && siteConfig != null)
	title = siteConfig.getTitle();

if (description == null && siteConfig != null)
	description = siteConfig.getMetaDescription();

if (keywords == null && siteConfig != null)
	keywords = siteConfig.getMetaKeywords();

if (ogSiteName == null && siteConfig != null)
	ogSiteName = siteConfig.getSiteName();

if (ogTitle == null && siteConfig != null)
	ogTitle = siteConfig.getTitle();

if (ogDescription == null && siteConfig != null)
	ogDescription = siteConfig.getMetaDescription();

if (ogUrl == null)
	ogUrl = UrlHelper.getServerUrl(request);

if (ogImage == null)
	ogImage = "http://immediatenet.com/t/t_a?Size=1024x768&URL=" + UrlHelper.getDomainServer(request);

%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=<%=siteConfig.getHttpCharacterSet().toUpperCase()%>">
	<meta name="description" content="<%=description.replaceAll("[\"\']+", "")%>" >
	<meta name="Keywords" content="<%=keywords.replaceAll("[\"\']+", "")%>" >
	<meta itemprop="name" content="<%=ogTitle.replaceAll("[\"\']+", "")%>" />    
	<meta itemprop="description" content="<%=ogDescription %>" />
	<meta property="og:site_name" content="<%=ogSiteName %>" >
	<meta property="og:title" content="<%=ogTitle.replaceAll("[\"\']+", "")%>" >
	<meta property="og:url" content="<%=ogUrl%>" >
	<meta property="og:image" content="<%=ogImage%>" >
	<meta property="og:description" content="<%=ogDescription %>" >
	<title><%=title%></title>

    <!-- Bootstrap -->
    <link href="/templates/<%=siteConfig.getTemplate() %>/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="/templates/<%=siteConfig.getTemplate() %>/css/style.css" rel="stylesheet" media="screen">
 </head>
<body>
<header id="header">
	<div class="container">
		<div class="row header">
			<div class="span4 logo">
				<a href="/"><img src="/templates/<%=siteConfig.getTemplate() %>/images/logo.png" ></a>
			</div>
			<div class="span8 clearfix" id="navbar">
				<ul class="nav nav-pills pull-right">
					<li class="active"><a href="/">Home</a></li>
					<li><a href="/about-us">About Us</a></li>
					<li><a href="/authors">Authors</a></li>
				</ul>
			</div>
		</div>
		
		<section id="search-bar" class="clearfix">
			<form class="form-actions pull-right" id="searchForm"  method="get" action="/search">
				<input name="q" class="span5" type="text" placeholder="Find a Question">
				<button type="submit" class="btn btn-info">Search</button>
			</form>
		</section>
	</div>	
</header>

<div id="content">
	<div class="container">